//
//  QGWebViewController.swift
//  斯威夫特微博
//
//  Created by youyoumacmini3 on 2017/8/10.
//  Copyright © 2017年 youyoumacmini3. All rights reserved.
//

import UIKit

/// 网页控制器
class QGWebViewController: QGBaseViewController {

    fileprivate lazy var webView = UIWebView(frame: UIScreen.main.bounds)

    
    /// 要加载的 URL 字符串
    var urlString: String? {
        didSet{
            guard let urlString = urlString,
                  let url = URL(string: urlString)
                else { return }
            webView.loadRequest(URLRequest(url: url))
            
        }
    }
    
    
}

extension QGWebViewController {
    
    override func setTableView() {
   
        navItem.title = "网页"
        // 设置webView
        view.insertSubview(webView, belowSubview: navigationBar)
        webView.backgroundColor = UIColor.white
        
        // 设置 contentInset
        webView.scrollView.contentInset.top = navigationBar.bounds.height
    }
    
}
